<?php


namespace App\Admin\Controllers;


use App\User;
use Encore\Admin\Auth\Database\Administrator;
use Illuminate\Http\Request;


class ApiController
{
    public function admin(Request $request)
    {
        $q = $request->get('q');

        return Administrator::where('name', 'like', "%$q%")->paginate(null, ['id', 'name as text']);
    }

    public function user(Request $request)
    {
        $q = $request->get('q');
        return User::where('name', 'like', "%$q%")->paginate(null, ['id', 'name as text']);
    }
}